package com.jxnu.nav_search.database;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import javax.sql.DataSource;

import androidx.annotation.Nullable;

public class SuggestionsSQLiteOpenHelper extends SQLiteOpenHelper {

    public static final String ID = "_id";
    public static final String NAME = "name";
    public static final String AGE = "age";
    public static final String SEX = "sex";
    public static final String TABLE_NAME = "person";

    private Context context;

    public SuggestionsSQLiteOpenHelper(@Nullable Context context) {
        super(context, "persons", null, 1);
        this.context = context;
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL("CREATE TABLE " + TABLE_NAME + "(" +
                ID + " INTEGER PRIMARY KEY AUTOINCREMENT,"
                + NAME + " TEXT NOT NULL,"
                + AGE + " INTEGER,"
                + SEX + " TEXT" + ")");
        System.out.println("database created!");
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        System.out.println("database update!");
    }

}
